#ifndef OPERATEDB_H
#define OPERATEDB_H

#include <QObject>
#include <QSqlDatabase>

class OperateDb : public QObject
{
    Q_OBJECT
public:
    explicit OperateDb(QObject *parent = nullptr);
    ~OperateDb();
    static OperateDb& getInstance();
    QSqlDatabase m_db;//数据库对象
    void connect();
    bool handleRegist(const char* name, const char* pwd);//处理注册
    bool handleLogin(const char* name, const char* pwd);//处理登录
    void handleOffLine(const char* name);
    int handleFindUser(const char* name);//查找用户函数
    QStringList handleOnlineUser();//无参数
    int handleAddFriend(const char* curName, const char* tarName);
    void handleAddFriendAgree(const char* curName, const char* tarName);
    QStringList handleOnlineFriend(const char* name);
    bool handleDelFriend(const char* curName, const char* tarName);

};

#endif // OPERATEDB_H
